import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OfferlibationVO, OfferlibationForm, OfferlibationQuery } from '@/api/cemetery/offerlibation/types';

/**
 * 查询代祭扫套餐列表
 * @param query
 * @returns {*}
 */

export const listOfferlibation = (query?: OfferlibationQuery): AxiosPromise<OfferlibationVO[]> => {
  return request({
    url: '/cemetery/offerlibation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询代祭扫套餐详细
 * @param id
 */
export const getOfferlibation = (id: string | number): AxiosPromise<OfferlibationVO> => {
  return request({
    url: '/cemetery/offerlibation/' + id,
    method: 'get'
  });
};

/**
 * 新增代祭扫套餐
 * @param data
 */
export const addOfferlibation = (data: OfferlibationForm) => {
  return request({
    url: '/cemetery/offerlibation',
    method: 'post',
    data: data
  });
};

/**
 * 修改代祭扫套餐
 * @param data
 */
export const updateOfferlibation = (data: OfferlibationForm) => {
  return request({
    url: '/cemetery/offerlibation',
    method: 'put',
    data: data
  });
};

/**
 * 删除代祭扫套餐
 * @param id
 */
export const delOfferlibation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/cemetery/offerlibation/' + id,
    method: 'delete'
  });
};
